#include <REGX52.H>
#include "Timer.h"
#include "INTRINS.H"
sbit ADDR0=P1^0;
sbit ADDR1=P1^1;
sbit ADDR2=P1^2;
sbit ADDR3=P1^3;
sbit ENLED=P1^4;

void Delay(unsigned int ms) //@11.0592MHz
{
	while(ms--);
}

void LED_Init()
{
	ADDR0=0;
	ADDR1=1;
	ADDR2=1;
	ADDR3=1;
	ENLED=0;
}

void main(){
	unsigned char Time,i;
	LED_Init();
	Timer0_Init();
	while(1)
	{
		for(Time=0;Time<100;Time++)
		{
			for(i=0;i<20;i++)
			{
				P0_0=0;
				Delay(Time);
				P0_0=1;
				Delay(100-Time);
			}
		}
		for (Time = 100; Time > 0; Time--)
		{
			for (i = 0; i < 20; i++)
			{
				P0_0 = 0;
				Delay(Time);
				P0_0 = 1;
				Delay(100 - Time);
			}
		}
	}
}

